﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RomaClient.RomaReference;


namespace RomaClient.Controllers
{
    public class ChatController : Controller
    {
        RoMaWSClient proxy = new RoMaWSClient();

        //
        // GET: /Chat/

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public PartialViewResult GetChatMessages()
        {
            chatMessageUI[] model = proxy.getChatMessages(1);
            return PartialView("_ChatMessages", model);
        }

        [HttpPost]
        public PartialViewResult AddChatMessage(string m)
        {
            userUI user = (userUI)Session["user"];
            proxy.createChatMessage(1, m, user.id);
            chatMessageUI[] model = proxy.getChatMessages(1);
            return PartialView("_ChatMessages", model);
        }


    }
}
